package com.icngor.action;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.springframework.beans.factory.annotation.Autowired;

import com.icngor.pageModel.Menu;
import com.icngor.service.MenuServiceI;
import com.opensymphony.xwork2.ModelDriven;

@Action(value="menuAction")
public class MenuAction extends BaseAction implements ModelDriven<Menu>{

	Menu menu = new Menu();
	private MenuServiceI menuService;
	
	@Override
	public Menu getModel() {
		return menu;
	}



	public MenuServiceI getMenuService() {
		return menuService;
	}
	@Autowired
	public void setMenuService(MenuServiceI menuService) {
		this.menuService = menuService;
	}

	public void getTreeNode(){
		List<Menu> mel = menuService.getTreeNode(menu.getId());
		super.writeJson(mel);
	}

	public void getAllTreeNode(){
		List<Menu> mel = menuService.getAllTreeNode();
		super.writeJson(mel);
	}
}
